import pandas as pd

# 定义函数来判断适用人群类别
def classify_applicable_population(row):
    if "0-12月龄" in row["适用人群"] \
        or "早产/低出生体重婴儿" in row["适用人群"] \
        or "婴儿" in row["适用人群"]:
        return "特医婴配食品"
    else:
        return "1岁以上特医食品"

if __name__ == "__main__":
    # 读取result2.xlsx文件
    df = pd.read_excel("/Users/lhmily/Desktop/2024data/data/Food_Manual/result2.xlsx")

    # 应用函数创建新列
    df["适用人群类别"] = df.apply(classify_applicable_population, axis=1)

    # 将结果保存回result2.xlsx
    df.to_excel("result2.xlsx", index=False)